home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / dskut / timep37e.zip / TIMEPRK7.ASM < prev    next >
Assembly Source File  |  1990-06-15  |  19KB  |  603 lines

  1. ;       TIMEPRK7.ASM    Version 3.70 *** 11 JUN 90 *** T.D. Cobb
  2. ;------------------------------------------------------------------------------
  3. PAGE 60,132
  4. ;
  5. ;       Assembles Under Tubro Asm Ver 1.0 
  6. ;
  7. ;       This TSR uses 73% Less Resident Memory (364% more efficient)
  8. ;       (176 bytes verses 640) Than Mr. Zelkovitz's Vers 1.1
  9. ;    Uses 32 bytes more if equated to save stack space (This should not
  10. ;    be needed.)
  11. ;
  12. ; ******************************************************************************
  13. ; * Assembled Vers 3.7 HAS to be Converted to a binary file with EXE2BIN.EXE   *
  14. ; * Before it can be load from CONFIG.SYS. (TIMEPARK.SYS already is)           *
  15. ; *           TIMEPARK.SYS HAS LOADED as a Device Driver                       *
  16. ; *                  DEVICE=TIMEPARK.SYS /Tn /S                                *
  17. ; * /Tn is Optional. Where "n" is 1 to 9 minutes & will reduce Display Message *   
  18. ; * /S is Optional.  This will totally suppress all of the Display Message.    *
  19. ; ******************************************************************************
  20. ;
  21. ;       Version 3 Should not lockup the keyboard on none XT class
  22. ;       Machines Like My Pervious Vers 2 or Mr. Zelkovitz's Vers 1.
  23. ;
  24. ;    Version 3.4 User can chose between Seek or Verify. It looks
  25. ;    like some Cache's Do Not Seek if the track is already in cache.
  26. ;    I would set "SEEK equ TRUE" if not using a Cache.
  27. ;
  28. ;    Version 3.6 fixed floppy drive hang problem.
  29. ;
  30. ;    Version 3.7 Put TSR in Device Drivers Clothing.
  31. ;
  32. ;       Use and Enjoy and pass this on.
  33. ;
  34. ;                                               Tom Cobb
  35. ;                                               130 Janice Dr.
  36. ;                                               Athens, Ga 30606
  37. ;                                               (404)543-8017
  38. ;
  39. ;The ARCHED distribution contains the following files:
  40. ;
  41. ;    1) TIMPARK1.ASM     The assembly source
  42. ;    2) TIMEPARK.COM     The load module
  43. ;    3) TIMEPARK.DOC     Original miserable manual
  44. ;    4) TIMEPRK7.ASM     this Assemble source
  45. ;    5) TIMEPRK7.SYS     this Assembled source load module
  46. ;
  47. ;This software is placed in the PUBLIC DOMAIN to be used for NON-COMMERCIAL
  48. ;purposes only. You may  freely copy  and  use  it  without  any charge.
  49. ;       
  50. ;This program  must not be sold for profit. An adaequate fee may be
  51. ;requested for  copying, shipping  and handling when redistributing
  52. ;this program.
  53. ;
  54. ;Also, all five files MUST be passed on.
  55. ;
  56. ;The software is supplied AS IS and absolutely NO guarantees are given or
  57. ;implied about its suitability.
  58. ;
  59. ;
  60. ;  Parts of this source code where written and placed in PUBLIC DOMAIN by
  61. ;
  62. ;                       ALPHA COMPUTER SERVICE
  63. ;                      ( Sanford J. Zelkovitz )
  64. ;                            714-894-6808
  65. ;
  66. ;            Christoph H. Hochstätter
  67. ;            Carl-Strehl-Strasse 20
  68. ;            D-3550 Marburg
  69. ;            West-Germany
  70. ;
  71. ;
  72. ; Vers 2.06
  73. ;       Worked on XT class machines. Used 208 Bytes Resident Memory
  74. ;
  75. ; Vers 3.00
  76. ;       Changed verifys to seeks when parking drives
  77. ;       Now parks on park cyl if roll over from lower 8 bits of Seek cyl
  78. ;       Now enables interrupt Controller Chip so no keyboard lockup
  79. ;       Changed TSR org Address so Code is on even memory boundary
  80. ;
  81. ; Vers 3.40
  82. ;       Changed Int 1C so as not to Reenter it's self and
  83. ;       Keep Better System Time
  84. ;    Setup equate to chose between Seeks and Verifies
  85. ;    Removed redundant park code
  86. ;
  87. ; Vers 3.50
  88. ;    Moved test for already parked to front of TST code
  89. ;
  90. ; Vers 3.60
  91. ;    Trap park code out while in Int 13
  92. ;
  93. ; Vers 3.70
  94. ;    Placed TSR routine in Device driver form
  95. ;    Setup equate to Save Caller Registers while parking drives
  96. ;
  97. ;------------------------------------------------------------------------------
  98. ;
  99. ;       *************************
  100. ;       these are general equates
  101. ;       *************************
  102. FALSE   EQU     0                       ; define logical values
  103. TRUE    EQU     NOT FALSE
  104.  
  105.     ;*************************
  106. SEEKS    EQU    FALSE       ;*        ; Set false for some Caches 
  107.     ;*************************        ; SET True when No Cache in use
  108.                         ; by System
  109.  
  110. sav_stack    EQU    false            ; If true uses 32 bytes more
  111.     ;  bytes of memory and takes some work off the stack while parking 
  112.     ;  drives. This is something to try if you are sure this TSR is
  113.     ;  hanging system. 
  114.     ;  
  115.                         
  116.  
  117. default_time    EQU    '3'            ; Number of minutes delay to 
  118.                         ;  before parking if
  119.                         ;  no "/Tn" Option used.
  120. ;
  121. ;       ------------- Program Output Messages -------------
  122. ;
  123. ;       Some non-display ASCII character values
  124. CR      EQU     0DH             ; ASCII Carriage Return
  125. LF      EQU     0AH             ; Line Feed
  126. BEL     EQU     07H
  127. ;       Graphics characters for borders on the displays
  128. V_BAR   EQU     0BAH
  129. H_BAR   EQU     0CDH
  130. U_LEFT  EQU     0C9H
  131. U_RIGHT EQU     0BBH
  132. L_LEFT  EQU     0C8H
  133. L_RIGHT EQU     0BCH
  134. TOP_T   EQU     0CBH
  135. BOT_T   EQU     0CAH
  136. ;
  137.  
  138. ; ------------  Our Flag Equates
  139.  
  140. parked_flag                 equ     0
  141. ;not_parked_flag         equ     not parked_flag
  142. ;out_of_our_code_flag        equ    0
  143. in_our_code_flag          equ     1
  144. in_int13_flag            equ    80h
  145.  
  146. Cseg            segment word public 'derice_dvr'
  147.                 assume  cs:Cseg, ds:Cseg, es:nothing, ss:nothing
  148.  
  149. ;==============================================================================
  150.  
  151.         org    0
  152.  
  153. ;------------------------------------------------------------------------------
  154. resident_park   proc    far
  155.  
  156.         dd        -1                ; No other device drivers
  157.         dw        1000000000000000b        ; Character-Device
  158. stra        dw        strategy            ; Strategy-Routine
  159. entr        dw        entry                ; Interrupt-Routine
  160.         db        '&TPARK37'            ; Dummy-Name
  161.  
  162. error        proc      far
  163.         mov       word ptr es:[bx+3],8103h            ; Return ERROR status 
  164.         retf                                          ; if called twice 
  165. error        endp                          ; by this Dummy-Device
  166.  
  167. ;------------------------------------------------------------------------------
  168. ;    if    sav_stack
  169.     even                            ; make next address even
  170. ;    endif
  171. count           dw      0                            ; time delay counter
  172.  
  173. ;==============================================================================
  174.  
  175. Ourint1c    proc    far
  176.     if    sav_stack
  177.         mov    word ptr cs:ax_sav,ax
  178.     else
  179.         push    ax
  180.     endif
  181.         xor    al,al
  182.  
  183.             cmp    al,0ffh                
  184. parked        equ    $-1            ; parked when set to zero
  185.                 jz      by_pass                 ; jmp if all ready parked
  186.  
  187.                 dec     word ptr cs:count    ; decrement time counter
  188.                 jns     by_pass                 ; now jmp if time left on counter
  189.  
  190.             cmp     al,0
  191. busy        equ    $-1
  192.                 jnz     by_pass                 ; JMP so as not to
  193.                                                 ; reenter our code and 
  194.                         ; don't park while int13 busy
  195.  
  196. ;       park both Hard drives
  197.  
  198.     if     sav_stack
  199.                 or    byte ptr cs:busy,in_our_code_flag          
  200.                             ; Set to not Zero when
  201.                         ; in our park code
  202.     sti
  203.         mov    word ptr cs:ds_sav,ds    ; save regs to local area
  204. ;        mov    word ptr cs:ax_sav,ax
  205.         mov    ax,cs
  206.         mov    ds,ax
  207.         mov    word ptr cx_sav,cx
  208.         mov    word ptr bx_sav,bx
  209.         mov    word ptr dx_sav,dx
  210.         mov    word ptr si_sav,si
  211. else
  212.                 push    ds            ; save caller DS reg
  213.     sti
  214.         push    cs
  215.         pop    ds            ;ds = this seg
  216.  
  217.                 or    byte ptr busy,in_our_code_flag          
  218.                             ; Set to not Zero when
  219.                         ; in our park code
  220.                 push    cx
  221.                 push    bx                      ; save regs
  222.                 push    dx
  223.         push    si
  224.  
  225.     endif
  226.  
  227.     cli
  228.                 mov     al,20h                  ; Enable interrupt
  229.         out     20h,al                  ; Controller chip
  230.     sti
  231.         mov    si,80h            ; first hard disk 
  232.  
  233. parkloop:       mov     ah,08
  234.                 mov     dx,si
  235.                 int     13h                     ; get max cyl of hard disk
  236.  
  237.                 mov     dx,si
  238.                 inc     ch
  239.                 jnc     less_512_cys_0
  240.                 add     cl,40h                  ; adjust upper 2 bits of cyl
  241.                                                 ;  in bits 6-7
  242. less_5